DEFINITION MODULE ControlMgr;  (* Christoph Fleischer 05.02.85 *)
                               (* MacIntosh Toolbox Control Manager Routines *)
                               (* last modification   26.06.85 fxk*)
FROM SYSTEM IMPORT ADDRESS;		       
FROM MacBase IMPORT StrPtr,LongInt,Handle;
FROM WindowMgr IMPORT WindowPtr;
FROM QuickDraw IMPORT Rect,Point;

EXPORT QUALIFIED
  drawCntl,testCntl,calcCRgns,initCntl,dispCntl,posCntl,thumbCntl,dragCntl,
  autoTrack,noControl,inButton,inCheckbox,inUpButton,inDownButton,inPageUp,
  inPageDown,inThumb,PushButProc,CheckBoxProc,RadioButProc,ScrollBarProc,UseWFont,
  ControlRecord,ControlPtr,ControlHandle,ControlProcPtr,
  NewControl,DisposeControl,KillControls,MoveControl,SizeControl,DragControl,
  ShowControl,HideControl,SetCTitle,GetCTitle,HiliteControl,SetCRefCon,GetCRefCon,
  SetCtlValue,GetCtlValue,GetCtlMin,GetCtlMax,SetCtlMin,SetCtlMax,GetCtlAction,
  SetCtlAction,TestControl,TrackControl,FindControl,DrawControls,GetNewControl;

CONST
  drawCntl     = 0;           (*control messages*)
  testCntl     = 1;
  calcCRgns    = 2;
  initCntl     = 3;
  dispCntl     = 4;
  posCntl      = 5;
  thumbCntl    = 6;
  dragCntl     = 7;
  autoTrack    = 8;

  noControl    = 0;           (*FindControl Result Codes*)
  inButton     = 10;
  inCheckbox   = 11;
  inUpButton   = 20;
  inDownButton = 21;
  inPageUp     = 22;
  inPageDown   = 23;
  inThumb      = 129;

  PushButProc   = 0;          (*control definition proc ID's*)
  CheckBoxProc  = 1;
  RadioButProc  = 2;
  ScrollBarProc = 16;

  UseWFont      = 8;


TYPE
  ProcPtr = ADDRESS;
  ControlHandle = POINTER TO ControlPtr;
  ControlPtr    = POINTER TO ControlRecord;
  ControlRecord =
     RECORD
       nextControl:        Handle;
       contrlOwner:        WindowPtr;
       contrlRect:         Rect;
       contrlVis:          BOOLEAN;
       contrlHilite:       BOOLEAN;
       contrlValue:        INTEGER;
       contrlMin:          INTEGER;
       contrlMax:          INTEGER;
       contrlDefProc:      Handle;
       contrlData:         Handle;
       contrlAction:       ProcPtr;
       contrlrfCon:        LongInt;
       contrlTitle:        ARRAY[0..255] OF CHAR;(*Str255*)
     END;

  ControlProcPtr =  ADDRESS;


PROCEDURE NewControl(curWindow:      WindowPtr;
                     VAR boundsRect: Rect;
                     title:          StrPtr;
                     visible:        BOOLEAN;
                     value:          INTEGER;
                     min:            INTEGER;
                     max:            INTEGER;
                     contrlProc:     INTEGER;
                     refCon:         LongInt): ControlHandle; (*INLINE $A954*)
PROCEDURE DisposeControl (theControl: ControlHandle);         (*INLINE $A955*)
PROCEDURE KillControls   (theWindow:  WindowPtr);             (*INLINE $A956*)

PROCEDURE MoveControl    (theControl: ControlHandle; h,v: INTEGER);
                                                              (*INLINE $A959*)
PROCEDURE SizeControl    (theControl: ControlHandle; w,h: INTEGER);
                                                              (*INLINE $A95C*)
PROCEDURE DragControl    (theControl: ControlHandle; startPt: Point;
                          VAR bounds,slopRect: Rect; axis:INTEGER);
                                                              (*INLINE $A967*)
PROCEDURE ShowControl    (theControl: ControlHandle);         (*INLINE $A957*)
PROCEDURE HideControl    (theControl: ControlHandle);         (*INLINE $A958*)
PROCEDURE SetCTitle      (theControl: ControlHandle;title: StrPtr);
                                                              (*INLINE $A95F*)
PROCEDURE GetCTitle      (theControl: ControlHandle; title: StrPtr);
                                                              (*INLINE $A95E*)
PROCEDURE HiliteControl  (theControl: ControlHandle; hiliteState: INTEGER);
                                                              (*INLINE $A95D*)
PROCEDURE SetCRefCon     (theControl: ControlHandle; data: LongInt);
                                                              (*INLINE $A95B*)
PROCEDURE GetCRefCon     (theControl: ControlHandle): LongInt;(*INLINE $A95A*)

PROCEDURE SetCtlValue    (theControl: ControlHandle; theValue: INTEGER);
                                                              (*INLINE $A963*)
PROCEDURE GetCtlValue    (theControl: ControlHandle): INTEGER;(*INLINE $A960*)

PROCEDURE GetCtlMin      (theControl: ControlHandle): INTEGER;(*INLINE $A961*)
PROCEDURE GetCtlMax      (theControl: ControlHandle): INTEGER;(*INLINE $A962*)
PROCEDURE SetCtlMin      (theControl: ControlHandle; theValue: INTEGER);
                                                              (*INLINE $A964*)
PROCEDURE SetCtlMax      (theControl: ControlHandle; theValue: INTEGER);
                                                              (*INLINE $A965*)

PROCEDURE GetCtlAction   (theControl: ControlHandle): ProcPtr;(*INLINE $A96A*)
PROCEDURE SetCtlAction   (theControl: ControlHandle; newProc: ControlProcPtr);
                                                              (*INLINE $A96B*)

PROCEDURE TestControl    (theControl: ControlHandle; thePt: Point): INTEGER;
                                                              (*INLINE $A966*)
PROCEDURE TrackControl   (theControl:ControlHandle; thePt: Point;
                          actionProc:ControlProcPtr):INTEGER; (*INLINE $A968*)

PROCEDURE FindControl    (thePoint: Point;
                          theWindow: WindowPtr;
                          VAR theControl: ControlHandle): INTEGER;(*INLINE $A96C*)
PROCEDURE DrawControls   (theWindow: WindowPtr);              (*INLINE $A969*)
PROCEDURE GetNewControl  (controlID: INTEGER; owner: WindowPtr): ControlHandle;
                                                              (*INLINE $A9BE*)

END ControlMgr.
